home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 2000 October: Mac OS SDK / Dev.CD Oct 00 SDK1.toast / Development Kits / Mac OS / Appearance SDK 1.0.4 / Appearance Sample Code / Source / ProgressPane.cp < prev    next >
Encoding:
Text File  |  1999-07-16  |  1.5 KB  |  85 lines  |  [TEXT/CWIE]

  1. /*
  2.     File:        ProgressPane.cp
  3.  
  4.     Contains:    Demonstration of different progress indicators.
  5.  
  6.     Version:    Appearance 1.0 SDK
  7.  
  8.     Copyright:    © 1997 by Apple Computer, Inc., all rights reserved.
  9.  
  10.     File Ownership:
  11.  
  12.         DRI:                Edward Voas
  13.  
  14.         Other Contact:        7 of 9, Borg Collective
  15.  
  16.         Technology:            OS Technologies Group
  17.  
  18.     Writers:
  19.  
  20.         (edv)    Ed Voas
  21.  
  22.     Change History (most recent first):
  23.  
  24.          <2>     9/25/97    edv        Get rid of movie stuff for now.
  25.          <1>     9/11/97    edv        First checked in.
  26. */
  27.  
  28. #include <Resources.h>
  29. #include "ProgressPane.h"
  30. #include "Appearance.h"
  31. #include "AppearanceHelpers.h"
  32.  
  33. enum
  34. {
  35.     kProgress1 = 1,
  36.     kProgress2 = 2,
  37.     kMovie        = 4
  38. };
  39.  
  40. static OSErr        GetMyFileSpec( FSSpecPtr file );
  41.  
  42. ProgressPane::ProgressPane( DialogPtr dialog, SInt16 items ) : MegaPane( dialog, items )
  43. {
  44.     AppendDialogItemList( dialog, 6001, overlayDITL );
  45.     
  46.     fProgressValue = 0;
  47.     fIsAscending = true;
  48.     
  49.     GetDialogItemAsControl( dialog, items + kProgress1, &fProgress1 );
  50.     GetDialogItemAsControl( dialog, items + kProgress2, &fProgress2 );
  51.     
  52.     SetProgressIndicatorState( fProgress2, false );
  53. }
  54.  
  55. ProgressPane::~ProgressPane()
  56. {
  57.     ShortenDITL( fDialog, CountDITL( fDialog ) - fOrigItems );
  58. }
  59.  
  60. void
  61. ProgressPane::Idle()
  62. {
  63.     IdleControls( fDialog );
  64.     
  65.     if ( fIsAscending )
  66.     {
  67.         fProgressValue += 2;
  68.         if ( fProgressValue > 100 )
  69.         {
  70.             fProgressValue = 98;
  71.             fIsAscending = false;
  72.         }
  73.     }
  74.     else
  75.     {
  76.         fProgressValue -= 2;
  77.         if ( fProgressValue < 0 )
  78.         {
  79.             fProgressValue = 2;
  80.             fIsAscending = true;
  81.         }
  82.     }
  83.     SetControlValue( fProgress1, fProgressValue );
  84. }
  85.